<template>
	<view class="d-flex flex-column j-sb px-3 pt-2">
		<view v-for="(item, index) in dataObj.list" :key="index">
			<news-item v-if="item.type === 'SMALL_IMAGE_CONTENT'" :item="item"></news-item>
			<poster-module v-else-if="item.type === 'ADVERTISEMENT'"></poster-module>
			<news-item-big v-else-if="item.type === 'BIG_IMAGE_CONTENT'" :item="item"></news-item-big>
		</view>
		<news-slide v-if="mainList.length > 0" :dataList="mainList"></news-slide>
	</view>
</template>

<script>
import newsItem from '@/components/module/news-item.vue';
import newsItemBig from '@/components/module/news-item-big.vue';
import posterModule from '@/components/module/poster-module.vue';
import newsSlide from '@/components/module/news-slide.vue';
export default {
	data() {
		return {
			moreText: '更多'
		};
	},
	components: {
		newsItem,
		newsItemBig,
		posterModule,
		newsSlide
	},
	computed: {
		mainList() {
			let arr = [];
			if (this.dataObj.list && this.dataObj.list.length > 0) {
				arr = this.dataObj.list.filter(item => {
					return item.type === 'SLIDE';
				});
				return arr;
			} else {
				return [];
			}
		}
	},
	methods:{
		handleMore(data){
			console.log(data)
			uni.navigateTo({
				url:'/pages/index/more/more?title=' + data.title
			})
		}
	},
	props: {
		dataObj: {
			type: Object,
			default: () => {
				return {
					module: 'cj',
					title: '财经',
					moduleType: 'cj',
					list: [
						{
							title: '广东自贸区南沙片区酝酿扩容',
							releaseDataDes: '4天前',
							customViews: '8',
							origin: '广州日报',
							type: 'BIG_IMAGE_CONTENT',
							commentCount: 0,
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/200918066n9c.png',
							contentId: 99702,
							url: 'http://www.creb.com.cn/mobile/dynamic.jhtml?id=99702'
						},
						{
							type: 'ADVERTISEMENT',
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/24143117cpm5.png',
							url: '123123'
						},
						{
							title: '因城施策 全年各地楼市微调不断',
							description: '融资收紧，限购政策不放松依然是房地产政策的主旋律。',
							releaseDataDes: '4天前',
							customViews: '75',
							origin: '新京报',
							type: 'SMALL_IMAGE_CONTENT',
							commentCount: 0,
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/20082954b6qp.png',
							contentId: 99698,
							url: 'http://www.creb.com.cn/mobile/dynamic.jhtml?id=99698'
						},
						{
							title: '深圳市住建局：二手房价年涨幅超5%可投诉',
							description: '按照宏观调控的长效机制要求，二手房年增幅不超过5%。',
							releaseDataDes: '4天前',
							customViews: '13',
							origin: '界面新闻',
							type: 'SMALL_IMAGE_CONTENT',
							commentCount: 0,
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/20080004iucw.png',
							contentId: 99692,
							url: 'http://www.creb.com.cn/mobile/dynamic.jhtml?id=99692'
						},
						{
							title: '百城新房库存同比增5.7% 已连增12个月',
							description: '全国百城新房住宅库存仍然处于上升的态势。',
							releaseDataDes: '4天前',
							customViews: '10',
							origin: '新京报网',
							type: 'SMALL_IMAGE_CONTENT',
							commentCount: 0,
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/20075442kd0c.png',
							contentId: 99691,
							url: 'http://www.creb.com.cn/mobile/dynamic.jhtml?id=99691'
						},
						{
							title: '2019年北京甲级写字楼空置率达15.9% 新增供应创历史新高',
							description: '15.9%  空置率达到近十年阶段性高点',
							releaseDataDes: '4天前',
							customViews: '13',
							origin: '新华网',
							type: 'SMALL_IMAGE_CONTENT',
							commentCount: 0,
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/19164742iruo.png',
							contentId: 99652,
							url: 'http://www.creb.com.cn/mobile/dynamic.jhtml?id=99652'
						},
						{
							title: '北京：集中曝光35家物业企业',
							description: '北京市将物业服务标准不规范、处置业主诉求不及时、侵占业主公共区域、扫黑除恶、自动售水机管理等十二类问题及时纳入专项治理范围。',
							releaseDataDes: '5天前',
							customViews: '139',
							origin: '中国房地产网',
							type: 'SMALL_IMAGE_CONTENT',
							commentCount: 0,
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/181623340cck.png',
							contentId: 99451,
							url: 'http://www.creb.com.cn/mobile/dynamic.jhtml?id=99451'
						},
						{
							title: '中铁置业获得“中铁诺德”商标专有权',
							description: '商标应用涵盖高端、改善、刚需等多类产品',
							releaseDataDes: '6天前',
							customViews: '2.7k',
							origin: '何道新 魏爱德 ',
							type: 'SMALL_IMAGE_CONTENT',
							commentCount: 0,
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/1810314557wt.png',
							contentId: 99322,
							url: 'http://www.creb.com.cn/mobile/dynamic.jhtml?id=99322'
						},
						{
							title: '深圳二手房业主哄抬房价被查处 官方：暂停网签',
							description: '违者将被暂停网签权限，并列入行业诚信黑名单。\n​',
							releaseDataDes: '6天前',
							customViews: '37',
							origin: '中国证券报',
							type: 'SLIDE',
							commentCount: 0,
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/18083617wwmg.png',
							contentId: 99295,
							url: 'http://www.creb.com.cn/mobile/dynamic.jhtml?id=99295'
						},
						{
							title: '周鹏：重度运营的3.0大悦城',
							description: '要从大开发为代表的增量时代过渡到以大运营为代表的存量时代。',
							releaseDataDes: '8天前',
							customViews: '476',
							origin: '中国房地产网',
							type: 'SLIDE',
							commentCount: 0,
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/1517561246rl.png',
							contentId: 98852,
							url: 'http://www.creb.com.cn/mobile/dynamic.jhtml?id=98852'
						},
						{
							title: '莫天全：地产未来是科技的竞赛',
							description: '地产的未来还有很多机会',
							releaseDataDes: '9天前',
							customViews: '22',
							origin: '中国房地产网',
							type: 'SLIDE',
							commentCount: 0,
							thumb: 'http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/15140450wdy0.png',
							contentId: 98846,
							url: 'http://www.creb.com.cn/mobile/dynamic.jhtml?id=98846'
						}
					]
				};
			}
		}
	}
};
</script>

<style></style>
